package modele.form;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;

import modele.beans.Building;
import modele.beans.Schedule;
import modele.beans.Employee;

import org.apache.struts.action.ActionForm;

public class ScheduleForm extends ActionForm {

	private static final long serialVersionUID = 8924436544592726715L;
	
	private String id;
	private String startingDate;
	private String endingDate;
	private String task;
	
	private ArrayList<Schedule> schedules;
	private ArrayList<Building> buildings;
	private ArrayList<Employee> employees;
	
	private String buildingID;
	private String employeeID;
	
	public String getStringMonday() {
		Calendar cal = Calendar.getInstance();
	    cal.set(Calendar.DAY_OF_WEEK,
	            cal.getActualMinimum(Calendar.DAY_OF_WEEK));
	    Date now = new Date();
	    cal.setTime(now);
	    int week = cal.get(Calendar.DAY_OF_WEEK);
	    Date m = new Date(now.getTime() - 24 * 60 * 60 * 1000 * (week - 2));
	    Date d = new Date(m.getTime() + 24 * 60 * 60 * 1000 * 6);
	    
	    DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
	    return "Horaire du " + df.format(m) + " au " + df.format(d);
	}

	public ArrayList<Schedule> getSchedules() {
		return schedules;
	}

	public void setSchedules(ArrayList<Schedule> schedules) {
		this.schedules = schedules;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getTask() {
		return task;
	}

	public void setTask(String task) {
		this.task = task;
	}

	public ArrayList<Building> getBuildings() {
		return buildings;
	}

	public void setBuildings(ArrayList<Building> buildings) {
		this.buildings = buildings;
	}

	public ArrayList<Employee> getEmployees() {
		return employees;
	}

	public void setEmployees(ArrayList<Employee> employees) {
		this.employees = employees;
	}

	public String getBuildingID() {
		return buildingID;
	}

	public void setBuildingID(String buildingID) {
		this.buildingID = buildingID;
	}

	public String getEmployeeID() {
		return employeeID;
	}

	public void setEmployeeID(String employeeID) {
		this.employeeID = employeeID;
	}

	public String getStartingDate() {
		return startingDate;
	}

	public void setStartingDate(String startingDate) {
		this.startingDate = startingDate;
	}

	public String getEndingDate() {
		return endingDate;
	}

	public void setEndingDate(String endingDate) {
		this.endingDate = endingDate;
	}


}